﻿using Abp;
using Mt.Site.Core.ContentManagement.Entities;
using Mt.Site.Core.ContentManagement.Impl;
using Mt.Site.Core.ContentManagement.Values;
using Mt.Site.Core.Navigations.Enums;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace Mt.Site.Core.ContentManagement
{
    public interface IContent2Manager
    {
        Task<Dictionary<string, object>> GetContentForEdit(Guid? id, long menuId, string customKey, Guid? relateId);

        Task<PagedContent<Dictionary<string, object>>> GetContentListByPagedAsync(
            Func<IQueryable<Content2>, IQueryable<Content2>> queryMethod,
            int skipCount,
            int getCount,
            string customKey, long menuId, Guid? relateId);

        Task<Guid> CreateAsync(Dictionary<string, string> values, long menuId, string customKey, Guid? relateId);

        Task<Guid> UpdateAsync(Dictionary<string, string> values, Guid contentId, long menuId, string customKey, Guid? relateId);

        Task<ContentConfig> GetConfig(string customKey, long menuId);
        Task<string> GetCustomKey(string customKey, long menuId);

        #region 仅Content表

        Task DeleteAysnc(Guid id, long menuId, Guid? relateId);

        Task DeleteListAysnc(IList<Guid> idList, long menuId, Guid? relateId);

        Task SetStatus(IList<Guid> idList, long menuId, bool isActive);

        Task SwapObjectSortAsync(List<Guid> idList, long menuId, List<int> orderList, Guid? relateId);

        Task SetNewOrderNumberAsync(Guid id, long menuId, int order, Guid? relateId);

        #endregion

        List<string> GetSpecialFields();

        //Task RecoverContentAsync(List<Guid> idList);

        Task MoveToAnotherMenuAsync(Guid id, long fromMenuId, Guid? fromRelateId, long toMenuId, Guid? toRelateId);

        Task CopyToOtherMenuAsync(Guid id, long fromMenuId, Guid? fromRelateId, long toMenuId, Guid? toRelateId);

        Task ShareToOtherMenuAsync(Guid id, long fromMenuId, Guid? fromRelateId, long toMenuId, Guid? toRelateId, ManagementType managementType);

        Task<SharedInfoOutput> GetSharedInfoAsync(Guid id, long menuId, Guid? relateId);

        /// <summary>
        /// 专题分享等操作 （局限是这个操作 ，一条信息 只有一种关联数据)
        /// </summary>
        /// <param name="customKey">可为空，无值会主动查找，主动传入的关联数据的key是customKey2的栏目的key</param>
        /// <param name="customKey2">被分享数据的key, 通过这个key找到列表页所有关联数据的key是这个customKey2的栏目</param>
        /// <returns></returns>
        Task<AllMenusForOperation> GetAllMenusForTopicOperationAsync(string customKey, string customKey2);

        Task<AllMenusForOperation> GetAllMenusForOperationAsync(
            string customKey, Guid id, ContentOperationType operationType, long currentMenu);

        Task<AllMenusForOperation> GetAllMenusAsync(string customKey);
    }
}